<template>
  <avue-crud :option="option"
             :data="data"
             @sortable-change="sortableChange"></avue-crud>
</template>
<script>
export default {
  data () {
    return {
      data: [{
        text1: '内容1-1',
        text2: '内容1-2'
      }, {
        text1: '内容2-1',
        text2: '内容2-2'
      }, {
        text1: '内容3-1',
        text2: '内容3-2'
      }, {
        text1: '内容4-1',
        text2: '内容4-2'
      }, {
        text1: '内容5-1',
        text2: '内容5-2'
      }],
      option: {
        rowSort: true,
        column: [{
          label: '列内容1',
          prop: 'text1',
        }, {
          label: '列内容2',
          prop: 'text2',
        }]
      }
    }
  },
  methods: {
    sortableChange (oldindex, newindex, row, list) {
      this.$message.success(oldindex + ',' + newindex)
      console.log(oldindex, newindex)
    }
  }
}
</script>